package com.base.study.presenter;

import android.app.Activity;
import android.support.v4.app.Fragment;

import com.base.commonlib.base.presenter.BasePresenter;
import com.base.commonlib.http.RealNetWorkUtil;
import com.base.commonlib.http.utils.CallBackImpl;
import com.base.study.bean.OnlineStudyListBean;
import com.base.study.bean.OnlineStudySecondListBean;
import com.base.study.bean.ScopeBean;
import com.base.study.view.OnlineStudyListView;
import com.base.study.view.OnlineStudySecondListView;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import io.reactivex.disposables.Disposable;

/**
 * Created by Administrator on 2020/2/21.
 */

public class OnlineStudSecondListPresenter extends BasePresenter<OnlineStudySecondListView> {
    public OnlineStudSecondListPresenter(OnlineStudySecondListView view,Activity activity) {
        super(view,activity);
    }

    public void getList(String id){
        Disposable enqueue = RealNetWorkUtil.get().method("api-train/category/listSecond").addParams("id",id)
                .build().enqueueForArray(OnlineStudySecondListBean.class, new CallBackImpl<List<OnlineStudySecondListBean>>() {
                    @Override
                    public void onError(int code, String msg, String errMsg) {
                        mView.showError();
                        mView.returnError();
                    }

                    @Override
                    public void onNext(List<OnlineStudySecondListBean> list) {
                                mView.returnList(list);
                    }
                });

        mCompositeDisposable.add(enqueue);
    }


}
